// 店铺管理
import {request} from '../utils/request'
// const BASE_URL_USER = 'http://dev.basic.lbs.p.yufeiworld.com'
// const BASE_URL_USER = 'http://dev.gateway.lbs.p.yufeiworld.com'
const BASE_URL_USER = ''
export type ShopInfo = {
    areaId: number,
    businessId: number,
    cityId: number,
    id: number,
    latitude: number,
    longitude: number,
    provinceId: number,
    sort: number,
    storeHeadName: string,
    storeHeadPhone: number,
    storeImagesIds: Array<number>,
    storeIntroduction: string,
    storeLocation: string,
    storeLogo: number,
    storeName: string,
    storePhone: number,
    storeStatus: number,
    tradeTime: string
}
// 新增店鋪
export const requestShopAdd = (shopInfo: Partial<ShopInfo>) => {
    return request({
        url: BASE_URL_USER + `/admin/basic/store/add`,
        method: "POST",
        data: shopInfo
    })
}
// 删除门店
export const requestShopDel = (id: number) => {
    return request({
        url: BASE_URL_USER + `/admin/basic/store/delete/${id}`,
        method: "DELETE",
        header: {
            'content-Type': 'x-www-form-urlencoded;charset=UTF-8'
        }
    })
}
// 修改门店状态-禁用
export const requestShopChainDisable = (id: number) => {
    return request({
        url: BASE_URL_USER + `/admin/basic/store/disable/${id}`,
        method: "PUT",
        header: {
            'content-Type': 'x-www-form-urlencoded;charset=UTF-8'
        }
    })
}
// 修改门店状态-启用
export const requestShopChainEnable = (id: number) => {
    return request({
        url: BASE_URL_USER + `/admin/basic/store/enable/${id}`,
        method: "PUT",
        header: {
            'content-Type': 'x-www-form-urlencoded;charset=UTF-8'
        }
    })
}

export type ShopGetAll = {
    areaId: number,
    cityId: number,
    endTime: string,
    pageNo: number,
    pageSize: number,
    provinceId: number,
    startingTime: string,
    storeHeadPhone: number,
    storeName: string,
    storeStatus: number
}
// 获取门店列表
export const requestShopGetAll = (shopGetAll: Partial<ShopGetAll>) => {
    return request({
        url: BASE_URL_USER + `/admin/basic/store/getAll`,
        method: "POST",
        data: shopGetAll
    })
}
// 修改门店信息
export const requestShopUpdatebyId = (shopInfo: Partial<ShopInfo>) => {
    return request({
        url: BASE_URL_USER + `/admin/basic/store/update`,
        method: "PUT",
        data: shopInfo
    })
}
// 获取门店信息
export const requestGetShopbyId = (id: number) => {
    return request({
        url: BASE_URL_USER + `/admin/basic/store/${id}`,
        method: "GET",
        header: {
            'content-Type': 'x-www-form-urlencoded;charset=UTF-8'
        }
    })
}
export type Interest = {
    storeId: number,
    userId: number
}
// 店铺关注
export const requestShopInterest = (interest: Partial<Interest>) => {
    return request({
        url: BASE_URL_USER + `/basic/store/interest`,
        method: "POST",
        data: interest
    })
}
export type InterestList = {
    page: number,
    pageSize: number,
    userId: number
}
// 店铺关注列表
export const requestShopInterestList = (interestList: Partial<InterestList>) => {
    return request({
        url: BASE_URL_USER + `/basic/store/interest/list`,
        method: "POST",
        data: interestList
    })
}
export type Location = {
    latitude: number,
    longitude: number,
    userId: number
}
// 用户定位上报
export const requestShopLocation = (location: Location) => {
    return request({
        url: BASE_URL_USER + `/basic/store/location`,
        method: "POST",
        data: location
    })
}
export type SelectList = {
    idList: Array<number>,
    pageNo: number,
    pageSize: number
}
// 获取活动选中的店铺和店铺对应的城市
export const requestShopSelectList = (selectList: Partial<SelectList>) => {
    return request({
        url: BASE_URL_USER + `/basic/store/select/list`,
        method: "POST",
        data: selectList
    })
}
export type StoreByCity = {
    cityIdList: Array<string>,
    pageNo: number,
    pageSize: number
}
// 获取城市下的店铺列表
export const requestShopGetStoreByCity = (storeByCity: Partial<StoreByCity>) => {
    return request({
        url: BASE_URL_USER + `/getStoreByCity`,
        method: "POST",
        data: storeByCity
    })
}